package com.imdroid.controller;

import java.util.ArrayList;
import java.util.Collection;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

import com.imdroid.modal.Team;

@ManagedBean(name = "team")
@SessionScoped
public class TeamController {
	/**
	 * the data modals
	 */
	protected DataModel datas = new ListDataModel();

	/**
	 * Get the teams
	 */
	public DataModel getTeams() {
		Collection collection = new ArrayList();
		for (int i : Team.allTeams().keySet()) {
			Team t = Team.getTeam(i);
			if (t != null)
				collection.add(t);
		}
		datas.setWrappedData(collection);
		
		return datas;
	}
}
